package com.mm.scheme.domian.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;

/**
 * @BelongsProject: chatgpt-java-develop
 * @BelongsPackage: com.unfbx.model
 * @Author : 游在海里的鱼
 * @CreateTime : 2024-03-17  16:04
 * @Version : 1.0
 * @ClassName : 方案
 * @Description : TODO
 */
@Data
@TableName("t_scheme")
public class Scheme {
    //编号
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    //用户id
    private Long uid;
    //标题
    private String title;
    //输入
    private String input;
    //正文
    private String steps;
    //状态,0存在,1删除
    private Byte state;
    //创建时间
    @JsonFormat( pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @TableField("createTime")
    private Date createTime;
    //修改时间
    @JsonFormat( pattern = "yyyy-MM-dd",timezone = "GMT+8")
    @TableField("updateTime")
    private Date updateTime;

    public void setAll(Scheme scheme){
        if(scheme.getId() != null){
            id = scheme.getId();
        }
        if(scheme.getUid() != null){
            uid = scheme.getUid();
        }
        if(scheme.getTitle() != null){
            title = scheme.getTitle();
        }
        if(scheme.getSteps() != null){
            steps = scheme.getSteps();
        }
        if(scheme.getCreateTime() != null){
            createTime = scheme.getCreateTime();
        }
        if(scheme.getUpdateTime() != null){
            updateTime = scheme.getUpdateTime();
        }
    }
}
